package Server;

import Factory.StudentFactory;
import dao.StudentDao;
import user.Student;

import javax.swing.plaf.synth.SynthUI;
import java.sql.SQLException;
import java.util.List;

public class StudentServer {

    private StudentDao studentDao;

    public StudentServer(){
        this.studentDao= StudentFactory.getStudentDao();
    }

    public List<Student> getStudentServer(String  start,String  end) throws SQLException {
        return studentDao.getStudent(start,end);
    }

    public int addstudentServer(Student student) throws SQLException {
        return studentDao.addStudent(student);
    }

    public int deleteStudentSerrver(String num) throws SQLException {
        return studentDao.deleteStudent(num);
    }

    public int motifyStudentServer(Student student) throws SQLException {
        return studentDao.motifyStudent(student);
    }

    public Student findStudentByIdServer(String num) throws SQLException {
        return studentDao.findStudentById(num);
    }

    public Student findStudentByNameServer(String name) throws SQLException {
        return studentDao.findStudentByName(name);
    }

    public int countStudent() throws SQLException {
        return studentDao.countStudent();
    }

}
